<template>
    <div class="message-container">
        <div class="top-nav">
            <div class="nav-item" :class="{ active: activeTab === 0 }" @click="changeTab(0)">资讯通知</div>
            <div class="nav-item" :class="{ active: activeTab === 1 }" @click="changeTab(1)">最新消息</div>
            <div class="nav-item" :class="{ active: activeTab === 2 }" @click="changeTab(2)">历史总览</div>
        </div>
        <div class="content">
            <div class="data-time">
                <p v-for="item in 9" :key="item" class="time">08:30:00</p>
            </div>
            <div class="data-num">
                <p v-for="item in 9" :key="item" class="num">{{ item }}</p>
            </div>
            <div class="data-describe">
                <p class="describe">号外号外号外号外号外号外号外号外</p>
                <p class="describe">号外号外号外号外号外号外号外号外号外号外号外号外</p>
                <p class="describe">号外号外号外号外号外号外号外号外号外号外号外</p>
                <p class="describe">号外号外号外号</p>
                <p class="describe">号外号外号外号外号外</p>
                <p class="describe">号外号外号外号外号外号外</p>
                <p class="describe">号外号外号外号外号外号外</p>
                <p class="describe">号外号外号外号外</p>
                <p class="describe">号外号外号外</p>
            </div>
        </div>
    </div>
</template>


<script setup lang="ts">
import { ref } from 'vue';
const activeTab = ref(1); // 当前激活的标签索引

// 切换标签方法
const changeTab = (index: number) => {
    activeTab.value = index;
};
</script>

<style scoped lang="scss">
.message-container {
    color: #fff;
    padding: 16.2px;
    border-radius: 8.1px;
    width: calc(100% + 8.5vh);
    max-width: calc(480px + 8.5vh);
    margin: 0 auto;

    /* 顶部导航 */
    .top-nav {
        display: flex;
        margin-bottom: 16.2px;
        height: 10px;
        .nav-item {
            padding: 7.2px 16.2px;
            cursor: pointer;
            font-size: 12px;
            color: #fff;
            height: 8px;
            width: 56px;
            text-align: center;
            line-height: 8px;
            border: 1.35px solid transparent; // 设置边框
            border-radius: 3.6px;
            transition: all 0.3s ease;
        }

        .nav-item:nth-child(2) {
            margin-left: 80px;
            clip-path: polygon(20% 0, 90% 0, 90% 100%, 0 100%);
            border: 1.6px solid rgb(8, 110, 112);
        }

        .nav-item:nth-child(3) {
            clip-path: polygon(20% 0, 90% 0, 90% 100%, 0 100%);
            border: 1.6px solid rgb(8, 110, 112);
        }

        .nav-item.active {
            background-color: rgb(32, 174, 226);
        }
    }

    /* 内容区域 */
    .content {
        width: 95%;
        height: calc(31.2vh);
        margin: auto;
        overflow: hidden;

        .data-time {
            width: 55px;
            height: calc(29.2vh);
            margin-top: 2vh;
            float: left;

            .time {
                line-height: 3.2vh;
                font-size: 13px;
            }
        }

        .data-num {
            width: 25px;
            height: calc(29.2vh);
            margin-top: 2vh;
            float: left;
            margin-left: 3vh;
            float: left;

            .num {
                line-height: 2.5vh;
                font-size: 13px;
                text-align: center;
                width: 100%;
                height: 2.5vh;
                background: #666666;
                margin-top: 6px;
            }

            .num:nth-child(1) {
                line-height: 2.5vh;
                font-size: 13px;
                text-align: center;
                width: 100%;
                height: 2.5vh;
                background: #5f0ced;
            }

            .num:nth-child(2) {
                line-height: 2.5vh;
                font-size: 13px;
                text-align: center;
                width: 100%;
                height: 2.5vh;
                background: #fe2277;
            }

            .num:nth-child(3) {
                line-height: 2.5vh;
                font-size: 13px;
                text-align: center;
                width: 100%;
                height: 2.5vh;
                background: #f9a403;

            }
        }

        .data-describe {
            width: 300px;
            height: calc(29.2vh);
            margin-top: 2vh;
            float: left;
            margin-left: 3vh;
            float: left;

            .describe {
                line-height: 3.2vh;
                font-size: 13px;
                width: 100%;
                height: 3.2vh;
            }
        }
    }
}
</style>